package com.example.mysdktest;

import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;

import com.example.mysdktest.activities.AntAddView;
import com.example.mysdktest.activities.HttpAnt;
import com.example.mysdktest.activities.MyHttpTest01;
import com.example.mysdktest.activities.Test02;
import com.example.mysdktest.base.BaseActivity;
import com.xm9m.ibczy.dsp.utils.AntLog;

import java.util.ArrayList;
import java.util.List;

public class MainActivity extends BaseActivity implements ListView.OnItemClickListener {
    private ListView lv;
    private ArrayAdapter<String> adapter;

    private List<String> sls;
    private List<Class> cls;


    @Override
    public int getLaout() {
        sls = new ArrayList<>();
        cls = new ArrayList<>();

        return R.layout.ac_main;
    }


    public void getData() {
//        sls.add("test01");
//        cls.add(Test01.class);
        sls.add("test02");
        cls.add(Test02.class);
//        sls.add("test03");
//        cls.add(Test03.class);
//        sls.add("test04");
//        cls.add(Test04.class);
//        sls.add("test05");
//        cls.add(Test05.class);

        sls.add("http test01");
        cls.add(MyHttpTest01.class);
        sls.add("HttpAnt test");
        cls.add(HttpAnt.class);

        sls.add("add view");
        cls.add(AntAddView.class);


    }

    @Override
    public void initView() {
        lv = (ListView) findViewById(R.id.ac_main_olv_lv01);
    }

    @Override
    public void initData() {
        getData();
        AntLog.i("asdf");
        adapter = new ArrayAdapter<String>(this, android.R.layout.simple_expandable_list_item_1, sls);
        lv.setAdapter(adapter);
    }

    @Override
    public void initListener() {
        lv.setOnItemClickListener(this);
    }

    @Override
    public void onItemClick(AdapterView<?> adapterView, View view, int position, long l) {
        jump2other(cls.get(position));
    }
}
